/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.sbbs.cdi.bean.discovery;

import javax.inject.Inject;
import javax.inject.Named;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Test;
import static org.junit.Assert.*;
import org.junit.runner.RunWith;

/**
 *
 * @author Mr.fdc <fdc_messenger@126.com>
 */
@RunWith(Arquillian.class)
public class GreetingIT {

    @Deployment
    public static Archive<?> deploy() {
        return ShrinkWrap.create(JavaArchive.class)
                .addClasses(Greeting.class, SimpleGreeting.class)
                .addAsManifestResource("beans.xml");
    }

    @Inject
//    @Named("simpleGreeting")
    @Simple
    Greeting bean;

    @Test
    public void should_bean_be_injected() throws Exception {
        assertThat(bean, is(notNullValue()));
        assertThat(bean, instanceOf(SimpleGreeting.class));
    }

}
